package com.leeon.exception;

class MyException extends Exception{
    public MyException(){}
    public MyException(String msg){
        super(msg);
    }
}

public class FullConstructors {
    public static void f()throws MyException{
        System.out.println("f Throwing MyException");
        throw new MyException();
    }

    public static void g() throws MyException{
        System.out.printf("g Throwing MyException");
        throw new MyException("originated in g()");
    }

    public static void main(String[] args) {

        try {
            f();
        }catch (MyException e){
            e.printStackTrace(System.out);
        }

        try{
            g();
        }catch (MyException e){
            e.printStackTrace(System.out);
        }
    }
}
